# create by fanfan on 2020/3/27 0027
from keras.models import Sequential
from keras.layers import Dense,Activation

## 对于具有 2 个类的单输入模型（二进制分类）：
model = Sequential()
model.add(Dense(32,activation='relu',input_dim=100))
model.add(Dense(1,activation='sigmoid'))
model.compile(optimizer='rmsprop',
              loss='binary_crossentropy',
              metrics=['accuracy'])

import numpy as np
data = np.random.random((1000,100))
labels = np.random.randint(2,size=(1000,1))

# 训练模型，以 32 个样本为一个 batch 进行迭代
model.fit(data,labels,epochs=10,batch_size=32)